/* 人事-基础设置-离职设置api */

import { ajaxService } from '@/utils/request';

const env = import.meta.env;
// const baseURL = env.VITE_DEV_BASE_URL;
// const baseURL = env.VITE_DEV_BASE_URL;
const baseURL = env.VITE_DEV_BASE_URL;
// const baseURL = 'http://192.168.31.129:39003';
// const baseURL2 = 'http://192.168.31.129:39001';
// const baseURL2 = 'http://192.168.31.129:39003';

// 获取离职面谈记录表列表
export function GetLeaveInterviewList(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/sheet/list',
    method: 'get',
    baseURL,
    params
  });
}
// 离职面谈记录表查重
export function RepeatLeaveInterviewList(params: { name: string }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/sheet/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 获取离职面谈记录表详情
export function GetLeaveInterviewDetail(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/sheet/detail',
    method: 'get',
    baseURL,
    params
  });
}

// 编辑离职面谈记录表列表
export function PostLeaveInterviewDetail(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/sheet/add',
    method: 'post',
    baseURL,
    data
  });
}

// 删除离职面谈记录表列表
export function DelLeaveInterviewList(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/sheet/delete',
    method: 'delete',
    baseURL,
    data
  });
}

// 删除离职面谈记录问题删除

export function DelLeaveInterviewTakeProblem(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/answer/delete',
    method: 'delete',
    baseURL,
    data
  });
}

// 编辑离职面谈记录表列表
export function PutLeaveInterviewDetail(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/sheet/update',
    method: 'put',
    baseURL,
    data
  });
}

// 编辑离职面谈记录表控件显示
export function PutLeaveInterviewTakeShow(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingTakeShow',
    method: 'put',
    baseURL,
    data
  });
}

// 编辑离职面谈默认模板
export function PutLeaveInterviewTemplate(data: { id: number; scope: number }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/interview_sheet/sheet/status/default',
    method: 'put',
    baseURL,
    data
  });
}

// 获取工作交接表列表
export function GetLeaveQuitList(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding',
    method: 'get',
    baseURL,
    params
  });
}

// 新增工作交接表
export function PostLeaveQuit(data: any) {
  return ajaxService(
    {
      url: '/hr/personnel_matters/basic_setting/offboarding',
      method: 'post',
      baseURL,
      data
    },
    {
      message: '新增成功',
      mode: 'success'
    }
  );
}

// 离职交接模板查重
export function RepeaLeaveQuitList(params: { name: string }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 获取工作交接表详情
export function GetLeaveQuitDetail(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/detail',
    method: 'get',
    baseURL,
    params
  });
}

// 删除工作交接表
export function DelLeaveQuitList(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding',
    method: 'delete',
    baseURL,
    data
  });
}

// 编辑工作交接表
export function PutLeaveQuitList(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding',
    method: 'put',
    baseURL,
    data
  });
}

// 修改工作交接表默认模板
export function PutLeaveQuitTemplateState(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/default',
    method: 'put',
    baseURL,
    data
  });
}

// 获取员工工作交接详情
export function GetSendWorkHandleDetail(params: {
  userId: number; // 人员id
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/use',
    method: 'get',
    baseURL,
    params
  });
}

// 获取员工工作交接详情
export function DelWorkHandleSub(data: {
  ids: []; // 子类的id
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/use',
    method: 'delete',
    baseURL,
    data
  });
}

// 修改员工工作交接进程状态
export function ChangeSendWorkHandleStatus(data: {
  id: number; // 人员id
  status: number; // 人员id
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/use/status',
    method: 'put',
    baseURL,
    data
  });
}

// 员工发起工作交接(确认发起)
export function SendWorkHandover(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/use',
    method: 'post',
    baseURL,
    data
  });
}

// 员工发起工作交接(保存)
export function SaveWorkHandover(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/offboarding/use',
    method: 'put',
    baseURL,
    data
  });
}

// 获取离职问题库列表
export function GetLeaveProblemList(params: {
  scopeApply: number;
  pageNumber?: number;
  pageSize?: number;
  search?: string;
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/leave_question_pool/per/leave/question/pool/page',
    method: 'get',
    baseURL,
    params
  });
}

// 离职问题库查重
export function RepeatLeaveProblemList(params: {
  question: string;
  scopeApply: number;
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/leave_question_pool/check/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 获取离职问题库详情
export function GetLeaveProblemDetail(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/resign_setting/resign_question_pool/per/resign/question/pool',
    method: 'get',
    baseURL,
    params
  });
}

// 新增离职问题库列表
export function PostLeaveProblemList(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/leave_question_pool/per/leave/question/pool',
    method: 'post',
    baseURL,
    data
  });
}

// 删除离职问题库列表
export function DelLeaveProblemList(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/leave_question_pool/per/leave/question/pool',
    method: 'delete',
    baseURL,
    data
  });
}

// 编辑离职问题库列表
export function PutLeaveProblemList(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/leave_setting/leave_question_pool/per/leave/question/pool',
    method: 'put',
    baseURL,
    data
  });
}

// 编辑离职问题库列表默认模板
export function PutLeaveProblemListDefault(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedure/default',
    method: 'put',
    baseURL,
    data
  });
}

// 获取离职手续模板设置列表
export function GetLeaveFormalitiesList(params: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedure',
    method: 'get',
    baseURL,
    params
  });
}
// 离职手续模板新增查重
export function RepeatLeaveFormalitiesList(params: { name: string }) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedure/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 新增离职手续模板设置列表
export function PostLeaveFormalitiesList(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedure',
    method: 'post',
    baseURL,
    data
  });
}

// 删除离职手续模板设置列表
export function DelLeaveFormalitiesList(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedure',
    method: 'delete',
    baseURL,
    data
  });
}

// 编辑离职手续模板设置列表
export function PutLeaveFormalitiesList(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedure',
    method: 'put',
    baseURL,
    data
  });
}

// 编辑离职手续子模板
export function PutLeaveFormalitiesProcedureDetails(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedureDetails',
    method: 'put',
    baseURL,
    data
  });
}

// 编辑离职手续模板控件显示
export function PutLeaveFormalitiesShow(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedureShow',
    method: 'put',
    baseURL,
    data
  });
}

// 新增离职手续子模板设置列表
export function PostLeaveFormalitiesSubTemplate(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedureDetails',
    method: 'post',
    baseURL,
    data
  });
}

// 编辑离职手续子模板设置列表
export function PutLeaveFormalitiesSubTemplate(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedureDetails',
    method: 'put',
    baseURL,
    data
  });
}

// 删除离职手续子模板设置列表
export function DelLeaveFormalitiesSubTemplate(data: any) {
  return ajaxService({
    url: '/pl/leave/offboardingProcedureDetails',
    method: 'delete',
    baseURL,
    data
  });
}

/**
 * 获取对应组织下面用户的数据
 * type： 组织类型 1公司 2部门
 * typeName： 组织id
 */
export function GetSectionPersonnel(params: {
  type: string | number;
  typeName: string;
}) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel',
    method: 'get',
    baseURL,
    params
  });
}
